package ar.edu.unicen.pladema.ui.mywidgets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;

import ar.edu.unicen.pladema.resources.ResourceManager;
import ar.edu.unicen.pladema.ui.panel.AbstractPanel;

public class IterationPanel extends AbstractPanel {
	private Group group;
	private Text valueText;
	private int value;
	
	public IterationPanel(Composite parent) {
		super(parent);
	}

	@Override
	protected void createWidgets() {
		group = new Group(this, SWT.SHADOW_ETCHED_IN);
		valueText = new Text(group, SWT.BORDER);

		group.setText(ResourceManager.getInstance().getText("ITERATION_TITLE"));
	}

	@Override
	protected void layoutWidgets() {
		this.setLayout(new FillLayout());
		group.setLayout(new FillLayout());
	}
	public void setValue(int i) {
		this.value = i;
		this.valueText.setText(Integer.toString(i));
	}
	public int getValue() {
		try {
			value = Integer.parseInt(valueText.getText());
		}catch(Exception e) {
			
		}
		return value;
	}
}
